﻿using System;
using System.Text.RegularExpressions;

namespace SentanceExtractor
{
    public class Program
    {
        public static void Main()
        {
            string word = "and";
            string pattern = @"\s*(([^\.!?]*?)" + word + @"([^\.!?]*)" + @"([\.!?]))";
            string text = 
                @"Describe in few words the regular expressions language and its major elements. " + 
                @"Describe the most important meta symbols, character classes and quantifiers." +
                @"Is it possible to check if the brackets in a number expression are set correctly " + 
                @"(if  there is a closing bracket for each opening one). Why?";

            Match match = Regex.Match(text, pattern);
            while (match.Success)
            {
                Console.WriteLine("{0}", match.Groups[1]);
                match = match.NextMatch();
            }
        }
    }
}
